#ifndef __FS_H__
#define __FS_H__

#include "lnthread.h"
#include "coumo.h"

/*
 *  []
 *  
 */
struct fs_file
{
  struct fs_file * next;
  LN_OID offset;
  void*  file_handle;
  void*  file_memory;
  int    file_size;
  int    ref_count;
};

typedef struct fs_file * fs_file_p;

struct fs_context_t
{
  char       path       [PATH_MAX];
  fs_file_p  file_cache [64];
};

typedef struct fs_context_t  *  fs_context_p;

int fs_create (LN_THREAD_PTR thrd, fs_context_p fs);
int fs_open   (LN_THREAD_PTR thrd, fs_context_p fs, const char* path);
int fs_close  (LN_THREAD_PTR thrd, fs_context_p fs);
int fs_read   (LN_THREAD_PTR thrd, fs_context_p fs, LN_OID offset, int size, char* buf);
int fs_alloc  (LN_THREAD_PTR thrd, fs_context_p fs, LN_OID offset, int size);

#endif
